using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.UIElements;
using UnityEditor.UIElements;
using System;
using Mono.Cecil;

public class BuffEditor : EditorWindow 
{ 
    [MenuItem("Tools/BuffEditor")]
    public static void Show()
    {
        BuffEditor wnd = GetWindow<BuffEditor>();
        wnd.titleContent = new GUIContent("BuffEditor");
    }

    private GraphViewBase mGraphView;

    public void CreateGUI()
    {
        // Import UXML
        var visualTree = Resources.Load<VisualTreeAsset>("UXML/BuffEditor");
        visualTree.CloneTree(rootVisualElement);

        mGraphView = rootVisualElement.Q<GraphViewBase>();

        OnSelectChanged();

        Selection.selectionChanged += OnSelectChanged;
    }

    private void OnSelectChanged()
    {
        mGraphView.RefreshView(Selection.activeObject as GraphViewData);
    }
}
